package day07;

import java.util.Scanner;

public class CalAirPrice {
    //scanner
    //int price int mouth int (1)头等舱 、(2)商务舱、(3)经济舱
    //方法：算价格  if mouth淡季  else 旺季
    //swtich (num) case 1 : case 2:
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入机票原价：");
        double price=scanner.nextDouble();
        System.out.println("请输入月份：");
        int mouth=scanner.nextInt();
        System.out.println("请选择舱位：1.头等舱 2.商务舱 3.经济舱");
        int type=scanner.nextInt();

        double totalPrice=CalAirPrice(price,mouth,type);
        if (totalPrice!=-1) {
            System.out.println("机票的最终价格为：" + totalPrice);
        }

    }
    public static double CalAirPrice(double price,int mouth,int type){
        double totalPrice=0.0;
        if (mouth<1||mouth>12){
            System.out.println("月份输入错误");
            return -1;
        }
        if(type<1 && type>3){
            System.out.println("舱位选择错误");
            return -1;
        }
        if (mouth>=5&&mouth<=10){//旺季
            switch (type){
                case 1:
                totalPrice=price*0.9;
                break;
                case 2:
                    totalPrice=price*0.85;
                    break;
                case 3:
                    totalPrice=price*0.8;
                    break;
            }
        }else{
            switch (type){
                case 1:
                    totalPrice=price*0.7;
                    break;
                case 2:
                    totalPrice=price*0.65;
                    break;
                case 3:
                    totalPrice=price*0.6;
                    break;
            }
        }
        return totalPrice;
    }


}
